Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fire GenericExceptionOnRun for batch-level exception #11003

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented Nov 14, 2024

Resolves #10840

Problem

When executing microbatch models, batch-level exceptions are not being associated to their base model in the fired RunningOperationError event because that event does not include a node_info.

Solution

  • Switch to using GenericExceptionOnRun

🎩

Invoking dbt with ['run']
16:31:02  Running with dbt=1.9.0-b4
16:31:02  Registered adapter: postgres=1.9.0-b1
16:31:02  Unable to do partial parsing because saved manifest not found. Starting full parse.
16:31:03  Found 3 models, 429 macros
16:31:03  
16:31:03  Concurrency: 4 threads (target='default')
16:31:03  
16:31:04  1 of 3 START sql table model test17316018506385627244_test_microbatch.input_model  [RUN]
16:31:04  1 of 3 OK created sql table model test17316018506385627244_test_microbatch.input_model  [SELECT 3 in 0.09s]
16:31:04  2 of 3 START sql microbatch model test17316018506385627244_test_microbatch.microbatch_model  [RUN]
16:31:04  1 of 3 START batch 2020-01-01 of test17316018506385627244_test_microbatch.microbatch_model  [RUN]
16:31:04  1 of 3 OK created batch 2020-01-01 of test17316018506385627244_test_microbatch.microbatch_model  [SELECT 1 in 0.04s]
16:31:04  2 of 3 START batch 2020-01-02 of test17316018506385627244_test_microbatch.microbatch_model  [RUN]
16:31:04  2 of 3 ERROR creating batch 2020-01-02 of test17316018506385627244_test_microbatch.microbatch_model  [ERROR in 0.01s]
16:31:04  Unhandled error while executing 
Exception on worker thread. Database Error
  syntax error at or near "invalid_sql"
  LINE 15:  invalid_sql
            ^
16:31:04  3 of 3 START batch 2020-01-03 of test17316018506385627244_test_microbatch.microbatch_model  [RUN]
16:31:04  3 of 3 OK created batch 2020-01-03 of test17316018506385627244_test_microbatch.microbatch_model  [MERGE 1 in 0.07s]
16:31:04  2 of 3 PARTIALLY created sql microbatch model test17316018506385627244_test_microbatch.microbatch_model  [PARTIAL SUCCESS (2/3) in 0.13s]
16:31:04  3 of 3 SKIP relation test17316018506385627244_test_microbatch.downstream_model . [SKIP]
16:31:04  
16:31:04  Finished running 1 incremental model, 1 table model, 1 view model in 0 hours 0 minutes and 0.97 seconds (0.97s).
16:31:04  
16:31:04  Completed with 1 partial success and 0 warnings
16:31:04  
16:31:04  Done. PASS=1 WARN=0 ERROR=1 SKIP=1 TOTAL=3

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@cla-bot cla-bot bot added the cla:yes label Nov 14, 2024
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.11%. Comparing base (2c43af8) to head (a759c26).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11003      +/-   ##
==========================================
- Coverage   89.12%   89.11%   -0.01%     
==========================================
  Files         183      183              
  Lines       23630    23630              
==========================================
- Hits        21060    21058       -2     
- Misses       2570     2572       +2     
Flag Coverage Δ
integration 86.50% <100.00%> (+<0.01%) ⬆️
unit 62.78% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 62.78% <0.00%> (ø)
Integration Tests 86.50% <100.00%> (+<0.01%) ⬆️

@MichelleArk MichelleArk marked this pull request as ready for review November 14, 2024 16:54
@MichelleArk MichelleArk requested a review from a team as a code owner November 14, 2024 16:54
@MichelleArk MichelleArk requested a review from QMalcolm November 14, 2024 16:54
@MichelleArk MichelleArk merged commit 35c0920 into main Nov 14, 2024
61 of 62 checks passed
@MichelleArk MichelleArk deleted the fix-microbatch-error-event branch November 14, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Database errors in microbatches are missing "node_info" in structured logs
2 participants